package cn.iocoder.yudao.module.wms.dal.mysql.sale;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wms.dal.dataobject.sale.SaleDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wms.controller.admin.sale.vo.*;

/**
 * 销售 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface SaleMapper extends BaseMapperX<SaleDO> {

    default PageResult<SaleDO> selectPage(SalePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SaleDO>()
                .eqIfPresent(SaleDO::getCommodity, reqVO.getCommodity())
                .eqIfPresent(SaleDO::getCompany, reqVO.getCompany())
                .eqIfPresent(SaleDO::getCount, reqVO.getCount())
                .eqIfPresent(SaleDO::getCreateAt, reqVO.getCreateAt())
                .eqIfPresent(SaleDO::getDescription, reqVO.getDescription())
                .eqIfPresent(SaleDO::getNumber, reqVO.getNumber())
                .eqIfPresent(SaleDO::getPay, reqVO.getPay())
                .eqIfPresent(SaleDO::getPhone, reqVO.getPhone())
                .eqIfPresent(SaleDO::getPrice, reqVO.getPrice())
                .orderByDesc(SaleDO::getUpdateAt));
    }

}